/**
 * 
 */
package com.pmsco.pms.services.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.pmsco.pms.core.dao.PmsMenuStructureDao;
import com.pmsco.pms.core.domain.PmsMenuStructure;
import com.pmsco.pms.services.interfaces.PmsMenuStructureService;

/**
 * @author Long Tran
 *
 */
public class PmsMenuStructureServiceImpl implements PmsMenuStructureService {
	private static final Logger logger = LoggerFactory.getLogger(PmsMenuStructureServiceImpl.class);

	private static PmsMenuStructureDao pmsMenuStructureDao;
	
	public PmsMenuStructure getPmsMenuStructure(Long parentId, Long childId) {
		logger.info("Start getPmsMenuStructure");
		logger.debug("Parent id: " + parentId);
		logger.debug("Child id: " + childId);
		PmsMenuStructure pmsMenuStructure = new PmsMenuStructure();
		pmsMenuStructure.setParentMenuId(parentId);
		pmsMenuStructure.setChildMenuId(childId);
		logger.info("End getPmsMenuStructure");
		return pmsMenuStructureDao.loadPmsMenuStructure(pmsMenuStructure);
	}
	
	public void saveOrUpdatePmsMenuStructure(PmsMenuStructure pmsMenuStructure) {
		pmsMenuStructureDao.saveOrUpdatePmsMenuStructure(pmsMenuStructure);
	}

	public void deletePmsMenuStructure(Long parentId, Long childId) {
		logger.info("Start deletePmsMenuStructure");
		logger.debug("Parent id: " + parentId);
		logger.debug("Child id: " + childId);
		PmsMenuStructure pmsMenuStructure = new PmsMenuStructure();
		pmsMenuStructure.setParentMenuId(parentId);
		pmsMenuStructure.setChildMenuId(childId);
		pmsMenuStructureDao.deletePmsMenuStructure(pmsMenuStructure);
		logger.info("End deletePmsMenuStructure");
	}
	
	/**
	 * @param pmsMenuStructureDao the pmsMenuStructureDao to set
	 */
	public void setPmsMenuStructureDao(PmsMenuStructureDao pmsMenuStructureDao) {
		logger.info("Start setPmsMenuStructureDao");
		logger.debug("Pms Menu Structure Dao: " + pmsMenuStructureDao);
		this.pmsMenuStructureDao = pmsMenuStructureDao;
		logger.info("End setPmsMenuStructureDao");
	}
}
